/**
 * 
 */
package com.feonix.lambda;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @CopyRight (c)1993-2017
 * @Project common_practice
 * @Comments 给出一个String类型的数组，找出其中各个素数，并统计其出现次数
 * @NameSpace com.feonix.lambda
 * @Author Feonixzw
 * @CreateDate 2017年12月27日
 */
public class PrimaryOccurrenceTest {
	
	
	 public static void primaryOccurrence(String... numbers) {
	        List<String> l = Arrays.asList(numbers);
	        Map<Integer, Integer> r = l.stream()
	            .map(e -> new Integer(e))
	            .filter(e -> Primes.isPrime(e))
	            .collect(Collectors.groupingBy(p->p, Collectors.summingInt(p->1)));
	        System.out.println("primaryOccurrence result is: " + r);
	    }
	

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		primaryOccurrence("1", "2", "3", "4", "5", "6", "3");

	}

}
